<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
	<xsl:template match="/">
		<html>
			<head>
				<link href="../../../style.css" rel="stylesheet" type="text/css" />
				<title>Pennyworth Analytics Log</title>
			</head>
			<body>
				<xsl:apply-templates/>
			</body>
		</html>
	</xsl:template>

	<xsl:template match="analytics/event">
		<p><span class="event">Event: <xsl:value-of select="@name" /></span><br />
		<xsl:choose>
			<xsl:when test="not(component)">
				<xsl:if test="string(.)">
					<xsl:value-of select="." /><br />
				</xsl:if>
				<xsl:value-of select="@date" />
			</xsl:when>
			<xsl:when test="component">
				<xsl:value-of select="@date" />
				<xsl:apply-templates select="component" />
			</xsl:when>
		</xsl:choose>
		</p>
	</xsl:template>

	<xsl:template match="component">
		<br /><span class="component"><xsl:value-of select="@name" />: <span class="component-value"><xsl:value-of select="." /></span></span>
	</xsl:template>

</xsl:stylesheet>